home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_09 / welstead / tssetlst.cpp < prev    next >
C/C++ Source or Header  |  1995-05-20  |  1KB  |  43 lines

  1. // TSSETLST.CPP Example of a typical function assigning
  2. //   setup structure fields to an object_list
  3.  
  4. #include <string.h>
  5. #include "tssetlst.h"
  6.  
  7. void init_setup (setup_record *the_setup) {
  8.    strcpy (the_setup->input_file_name,"filename.dat");
  9.    strcpy (the_setup->str_data,"Rectangle");
  10.    the_setup->rect_color = RGB (255,0,0);  // Red
  11.    return; }
  12.  
  13. void setup_to_collection (setup_record *the_setup,
  14.    object_list *the_collection) {
  15.         void *value_ptr = NULL;
  16.       tdata_type the_type;
  17.       unsigned short len;
  18.       int item_no = 0;  
  19.  
  20.    value_ptr = &the_setup->input_file_name;
  21.    the_type = PATH_DATA;
  22.    len = MAX_PATH;
  23.    item_no++;
  24.    the_collection->add_item (new ttyped_data_obj (
  25.      "Input File Name",value_ptr,the_type,len,
  26.      "*.DAT",item_no));
  27.    value_ptr = &the_setup->str_data;
  28.    the_type = STR_DATA;
  29.    len = STR_DATA_LEN;
  30.    item_no++;
  31.    the_collection->add_item (new ttyped_data_obj (
  32.      "String Data",value_ptr,the_type,len,
  33.      "",item_no));
  34.    value_ptr = &the_setup->rect_color;
  35.    the_type = COLOR_DATA;
  36.    len = 17;
  37.    item_no++;
  38.    the_collection->add_item (new ttyped_data_obj (
  39.      "Rect Color",value_ptr,the_type,len,
  40.      "",item_no));
  41.    return; }
  42.  
  43.